<include file="Public/min-header"/>
<div class="wrapper">
  <include file="Public/breadcrumb"/>
    <section class="content">
    <div class="row">
      <div class="col-xs-12">
      	<div class="box">
           <!--<nav class="navbar navbar-default">
			    <div class="collapse navbar-collapse">
                <div class="navbar-form pull-right margin">
                      <if condition="$order['order_status'] lt 2">
                         <a href="{:U('Admin/order/edit_order',array('order_id'=>$order['order_id']))}" data-toggle="tooltip" title="" class="btn btn-primary" data-original-title="编辑">修改订单</a>
                      </if>
                      <if condition="($split eq 1) and ($order['order_status'] lt 2)">
                         <a href="{:U('Admin/order/split_order',array('order_id'=>$order['order_id']))}" data-toggle="tooltip" title="" class="btn btn-primary" data-original-title="编辑">拆分订单</a>
                      </if>
                      <a href="{:U('Order/order_print',array('order_id'=>$order['order_id']))}" target="_blank" data-toggle="tooltip" title="" class="btn btn-primary" data-original-title="打印订单">
	                     <i class="fa fa-print"></i>打印订单
	                  </a>
                      <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
               </div>
            </div>
           </nav>-->

        <!--新订单列表 基本信息-->
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title text-center">基本信息</h3>
            </div>
            <div class="panel-body">
                <table class="table table-bordered">
                    <tbody>
                    <tr>
                        <td>订单 ID:</td>
                        <td>订单号:</td>
                        <td>会员:</td>
                        <!--<td>E-Mail:</td>-->
                        <td>电话:</td>
                        <td>所购店铺:</td>
                        <td>店铺编号:</td>
                        <td>应付:</td>
                        <td>订单 状态:</td>
                        <td>下单时间:</td>
                        <td>支付时间:</td>
                        <td>支付方式:</td>
                        <td>业务员:</td>

                        <if condition="($order['pay_status'] eq 0) and ($order['transfer_vouchers'] neq '')">
                            <td>转账凭证:</td>
                        </if>
                    </tr>
                    <tr>
                        <td>{$order.order_id}</td>
                        <td>{$order.order_sn}</td>
                        <td><a href="{:U('user/detail',array('id'=>$order['user_id']))}" >{$order.user_id|get_user_name}</a></td>
                        <!--<td><a href="#">{$order.email}</a></td>-->
                        <td>{$order.user_id|get_user_mobile}</td>
                        <td>{$order.goods_id|get_goods_name}</td>
                        <td>{$order.goods_id|get_goods_number}</td>
                        <td>{$order.pay_price}</td>
                        <td id="order-status"> {$order[order_id]|get_order_status}
                            <!--<if condition="$order['order_status'] eq 6"><span style="color: red">已完成</span><else/>{$pay_status[$order[pay_status]]}</if>  -->
                        </td>
                    	<td>{$order.add_time|date='Y-m-d H:i',###}</td>
                    	<td><if condition="$order.pay_time neq 0">
                            {$order.pay_time|date='Y-m-d H:i',###}
                         <else/>
                            N
                         </if>
                        </td>
                        <td id="pay-type">
                            {$order.pay_name|default='其他方式'}
                        </td>
                        <td >
                            {$order.sales_id|get_sales_name}
                            <if condition="$order[sales_id] eq ''"><button type="button" onclick="fenpei_sales({$order.order_id})">分配</button></if>
                        </td>
                        <if condition="($order['pay_status'] eq 0) and ($order['transfer_vouchers'] neq '')">
                            <td>{$order.transfer_vouchers}</td>
                        </if>

                    </tr>

                    </tbody>
                </table>
            </div>
        </div>

<script>
    function fenpei_sales(order_id){


        var url = '/index.php?m=Admin&c=Order&a=fenpei_sales&order_id='+order_id;
        layer.open({
            type: 2,
            title: '分配业务员',
            shadeClose: true,
            shade: 0.3,
            area: ['800px', '400px'],
            content: url,
        });

    }
</script>





            <if condition="$order[order_status] eq 6">


                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title text-center">成功案例</h3>
                    </div>
                    <div class="panel-body">
                        <form action="{:U('addEditCase')}" method="post" id="form1">
                            <input name="order_id" id="order_id" value="{$order.order_id}" type="hidden">
                            <input name="id" id="id" value="{$order.case.id}" type="hidden">
                            <table class="table table-bordered">
                                <tr>
                                    <td>标题：</td>
                                    <td>  <input  class="form-control" name="title" id="title"  value="{$order.case.title}" type="text"></td>
                                </tr>

                                <tr>
                                    <td>客户昵称：</td>
                                    <td>  <input  class="form-control" name="nickname" id="nickname"  value="{$order.case.nickname}" type="text"></td>
                                </tr>
                                <tr>
                                    <td>采访问题1：</td>
                                    <td>  <input  class="form-control" name="q1" id="q1" value="{$order.case.q1}" type="text"></td>
                                </tr>
                                <tr>
                                    <td>采访问题2：</td>
                                    <td>  <input  class="form-control" name="q2" id="q2" value="{$order.case.q2}" type="text"></td>
                                </tr>
                                <tr>
                                    <td>采访问题3：</td>
                                    <td>  <input  class="form-control" name="q3" id="q3" value="{$order.case.q3}" type="text"></td>
                                </tr>
                                <tr>
                                    <td>采访回答1：</td>
                                    <td>  <input  class="form-control" name="a1" id="a1" value="{$order.case.a1}" type="text"></td>
                                </tr>
                                <tr>
                                    <td>采访回答2：</td>
                                    <td>  <input  class="form-control" name="a2" id="a2" value="{$order.case.a2}" type="text"></td>
                                </tr>
                                <tr>
                                    <td>采访回答3：</td>
                                    <td>  <input  class="form-control" name="a3" id="a3" value="{$order.case.a3}" type="text"></td>
                                </tr>


                                <tr>
                                    <td>交易图片：<br/><span style="color:red">(尺寸：600*430)</span></td>
                                    <td>
                                        <input type="button" value="上传交易图片"  onclick="GetUploadify(1,'','goods','call_back5');"/>
                                        <input   type="text" class="input-sm"  name="images" id="xuqiankaoke_img" value="{$order.case.images}"/>
                                        <if condition="$order['case']['images'] neq null">
                                            &nbsp;&nbsp;
                                            <a target="_blank" href="{$order.case.images}" id="xuqiankaoke_img1">
                                                <img width="25" height="25" src="/Public/images/image_icon.jpg">
                                            </a>
                                        </if>
                                    </td>
                                </tr>
                                <tr>
                                    <td>交易描述：</td>
                                    <td>
                                        <textarea  class="form-control" rows="6" cols="120" name="content" id="content" placeholder="请输入交易描述，用于案例展示使用！"  >{$order.case.content}</textarea>
                                    </td>
                                </tr>




                                <tr>
                                    <td> </td>
                                    <td>     <input type="submit" class="btn btn-success"   id="btn1" value="提交"></td>
                                </tr>

                            </table>
                        </form>
                    </div>
                </div>



            <else/>

                <!--新订单列表 操作信息-->
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title text-center">操作信息</h3>
                    </div>
                    <div class="panel-body">
                        <table class="table table-bordered">
                            <tbody>
                            <tr>
                                <div class="row">
                                    <td class="text-right col-sm-2"><p class="margin">操作备注：</p></td>
                                    <td colspan="3">
                                        <form id="order-action">
                                            <textarea name="note" placeholder="请输入操作备注" rows="3" class="form-control"></textarea>
                                        </form>
                                    </td>
                                </div>
                            </tr>
                            <tr>
                                <div class="row">
                                    <td class="text-right col-sm-2"><p class="margin">可执行操作： </p></td>
                                    <td colspan="3">
                                        <div class="input-group">

                                            <foreach name="button" item="vo" key="k">
                                                <if condition="$k eq 'pay_cancel'">
                                                    <a class="btn btn-primary margin" href="javascript:void(0)" data-url="{:U('Order/pay_cancel',array('order_id'=>$order['order_id']))}" onclick="pay_cancel(this)">{$vo}</a>
                                                    <elseif condition="$k eq 'delivery'"/>
                                                    <a class="btn btn-primary margin" href="{:U('Order/delivery_info',array('order_id'=>$order['order_id']))}">{$vo}</a>
                                                    <elseif condition="$k eq 'refund'"/>
                                                    <!--退货商品列表-->
                                                    <!-- <input class="btn btn-primary" type="button" onclick="selectGoods2({$order['order_id']})" value="退货申请"> 	-->
                                                    <else/>
                                                    <button class="btn btn-primary margin" onclick="ajax_submit_form('order-action','{:U('Admin/order/order_action',array('order_id'=>$order['order_id'],'type'=>$k))}');" type="button" id="confirm">
                                                        {$vo}</button>
                                                </if>
                                            </foreach>
                                        </div>
                                    </td>
                                </div>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

                <!--新订单列表 操作记录信息-->
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title text-center">操作记录</h3>
                    </div>
                    <div class="panel-body">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <td class="text-center">操作者</td>
                                <td class="text-center">操作时间</td>
                                <td class="text-center">订单状态</td>
                                <td class="text-center">付款状态</td>
                                <!--<td class="text-center">发货状态</td>-->
                                <td class="text-center">描述</td>
                                <td class="text-center">备注</td>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="action_log" id="log">
                                <tr>
                                    <td class="text-center">{$log.action_user}</td>
                                    <td class="text-center">{$log.log_time|date='Y-m-d H:i:s',###}</td>
                                    <td class="text-center">{$order_status[$log[order_status]]}</td>
                                    <td class="text-center">{$pay_status[$log[pay_status]]} </td>
                                    <!--<td class="text-center">{$shipping_status[$log[shipping_status]]}</td>-->
                                    <td class="text-center">{$log.status_desc}</td>
                                    <td class="text-center">{$log.action_note}</td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                    </div>
                </div>



            </if>


        </div>
	  </div>
    </div>
   </section>
</div>
</body>
<script>



    function call_back5(fileurl_tmp){
        $("#xuqiankaoke_img").val(fileurl_tmp);
        $("#xuqiankaoke_img1").attr('href', fileurl_tmp);
    }



function pay_cancel(obj){
    var url =  $(obj).attr('data-url')+'/'+Math.random();

    layer.open({
        type: 2,
        title: '退款操作',
        shadeClose: true,
        shade: 0.8,
        area: ['45%', '50%'],
        content: url,
    });
}
//取消付款
function pay_callback(s){
	if(s==1){
		layer.msg('操作成功', {icon: 1});
		layer.closeAll('iframe');
		location.href =	location.href;
	}else{
		layer.msg('操作失败', {icon: 3});
		layer.closeAll('iframe');
		location.href =	location.href;
	}
}

// 弹出退换货商品
function selectGoods2(order_id){
	var url = "/index.php?m=Admin&c=Order&a=get_order_goods&order_id="+order_id;
	layer.open({
		type: 2,
		title: '选择商品',
		shadeClose: true,
		shade: 0.8,
		area: ['60%', '60%'],
		content: url,
	});
}
// 申请退换货
function call_back(order_id,goods_id)
{
	var url = "/index.php?m=Admin&c=Order&a=add_return_goods&order_id="+order_id+"&goods_id="+goods_id;
	location.href = url;
}
</script>
</html>